package com.newer.his.paiban.controller;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.newer.his.common.entity.Working;
import com.newer.his.paiban.service.PaibanService;

@RestController
@RequestMapping("/paiban")
public class PaibanController {
	@Autowired
	PaibanService paibanservice;
	@GetMapping()
	public String guahaohome() {
		return "../templates/paiban/paiban.html";
	}
	
	
	@GetMapping("/{deptid}/{date}")
	 public List<Working> GetWoking(@PathVariable int deptid,
			 @PathVariable @DateTimeFormat(iso = ISO.DATE)  Date date) {
		
		 return paibanservice.GetWokingByDayService(date,deptid );
	 }
	
	
	
	
	/**
//	 * 给定一个日期   和一个 医生id ,wokTime 的值  修改该医生当天的排班状态
	 * @return 
	 */
	@PutMapping("/{doctorid}/{date}")
	public Object UpdateWorTime(
			@PathVariable int doctorid,
			 @PathVariable @DateTimeFormat(iso = ISO.DATE)  Date date,
			@RequestBody Working working) {
		return paibanservice.PutWokingByservice(working);
		
		
	}
	
	
	

}
